#ifndef BUILDER_H
#define BUILDER_H
#include <iostream>
#include <string.h>
#include "javabean.h"

using namespace std;

class House {
    PropertyBuilderByName(string,floor,private)
    PropertyBuilderByName(string,wall,private)
    PropertyBuilderByName(string,door,private)
    public:
    friend ostream& operator<<(ostream &os,const House &h){
        os<<h.m_door<<" : "<< h.m_wall <<" : "<<h.m_floor<<endl;
        return os;
    }
};

class Builder{
public:
    virtual ~Builder(){};
    virtual void makeFloor()=0;
    virtual void makeWall()=0;
    virtual void makeDoor()=0;
    virtual House *GetHouse() = 0;
};


class FlatBuild:public Builder{
PointerPropertyBuilderByName(House,house,private)
public:
    FlatBuild(){
        this->m_house=new House();
    }
    ~FlatBuild(){
        delete this->m_house;
    }
public:
    void makeFloor(){
        m_house->setfloor("Flat door");
    }
    void makeWall(){
        m_house->setwall("Flat wall");
    }
    void makeDoor(){
        m_house->setdoor("Flat door");
    }
    virtual House *GetHouse(){
        return this->gethouse();
    }
};

class VillaBuild:public Builder{
PointerPropertyBuilderByName(House,house,private)
public:
    VillaBuild(){
        this->m_house=new House();
    }
    ~VillaBuild(){
         delete this->m_house;
    }
public:
    void makeFloor(){
        m_house->setfloor("Villa door");
    }
    void makeWall(){
        m_house->setwall("Villa wall");
    }
    void makeDoor(){
        m_house->setdoor("Villa door");
    }
    virtual House *GetHouse(){
        return this->gethouse();
    }
};

/**
 * @brief The Director class
 */
class Director{

public:
    void Construct(Builder* builder){
        builder->makeDoor();
        builder->makeWall();
        builder->makeFloor();
        cout<<*(builder->GetHouse());
    }
};

#endif // BUILDER_H

